<template>
  <n-checkbox-group
    :value="modelValue"
    :size="option?.size"
    :disabled="option?.disabled"
    @update:value="(v, m) => (option?.onUpdate?.(v, m), $emit('update:modelValue', v, m))">
    <template v-for="item in dicData" :key="item.value">
      <n-checkbox :value="item.value" :label="item.label" :disabled="item.disabled" />
    </template>
  </n-checkbox-group>
</template>

<script lang="ts" setup>
import { NCheckboxGroup, NCheckbox } from "naive-ui";
import { useDicData } from "./use-dic-data";
import type { CheckboxItemOption, CheckboxOption } from "../form-item-types";

const props = defineProps<{ modelValue: any; option?: CheckboxOption }>();

const { dicData } = useDicData<CheckboxItemOption>(props);
</script>
